import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/index.vue'
import recommend from '../components/bookmall/components/recommend.vue';

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index',
  },
  {
    path: '/index',
    component: index,
    children: [
      { path: "/", redirect: 'recommend' },
      {
        path: 'recommend',
        name: 'recommend',
        component: recommend
      },
      {
        path: 'boysRec',
        name: 'boysRec',
        component: () => import('../components/bookmall/boys/boysRec.vue')
      },
      {
        path: 'girlsRec',
        name: 'girlsRec',
        component: () => import('../components/bookmall/girls/girlsRec.vue')
      }
    ]
  },
  { // 书城
    path: '/index',
    component: index,
  },
  { // 书架
    path: "/bookshelf",
    name: "bookshelf",
    component: () => import("../views/bookshelf.vue")
  },
  { // 分类
    path: "/classification",
    name: "classification",
    component: () => import("../views/classification.vue"),
    children: [
      { path: "/", redirect: 'boysClass' },
      {
        path: 'boysClass',
        name: 'boysClass',
        component: () => import('../components/classification/boys/boysClass.vue')
      },
      {
        path: 'girlsClass',
        name: 'girlsClass',
        component: () => import('../components/classification/girls/girlsClass.vue')
      },
      {
        path: 'pubClass',
        name: 'pubClass',
        component: () => import('../components/classification/publish/pubClass.vue')
      }
    ]
  },
  {
    path: '/publicRank',
    name: 'publicRank',
    component: () => import('../components/classification/publicRank.vue')
  },
  { // 我的
    path: "/myself",
    name: "myself",
    component: () => import("../views/myself.vue")
  },
  {
    path: '/synopsis',
    name: 'synopsis',
    component: () => import('../components/base/synopsis.vue')
  },
  // 内容
  {
    path: '/content',
    name: 'content',
    component: () => import('../components/base/content.vue')
  },
  // 目录
  {
    path: '/catalogue',
    name: 'catalogue',
    component: () => import('../components/base/catalogue.vue')
  },
  // 粉丝榜
  {
    path: '/fans',
    name: 'fans',
    component: () => import('../components/base/fans.vue')
  },
  // 评论
  {
    path: '/comment',
    name: 'comment',
    component: () => import('../components/base/comment.vue')
  },
  // 书豆充值
  {
    path: '/bookBean',
    name: 'bookBean',
    component: () => import('../components/base/bookBean.vue')
  },
  // 登录
  {
    path: '/login',
    name: 'login',
    component: () => import('../components/base/login.vue')
  },
  // 书评
  {
    path: '/review',
    name: 'review',
    component: () => import('../components/mine/review.vue')
  },
  // 历史
  {
    path: '/history',
    name: 'history',
    component: () => import('../components/mine/history.vue')
  },
  // 收藏
  {
    path: '/collection',
    name: 'collection',
    component: () => import('../components/mine/collection.vue')
  },
  // 消息
  {
    path: '/message',
    name: 'message',
    component: () => import('../components/mine/message.vue')
  },
  // 书豆
  {
    path: '/mineBean',
    name: 'mineBean',
    component: () => import('../components/mine/mineBean.vue')
  },
  // 豆券
  {
    path: '/BeanTicket',
    name: 'BeanTicket',
    component: () => import('../components/mine/BeanTicket.vue')
  },
  // 章节券
  {
    path: '/chapter',
    name: 'chapter',
    component: () => import('../components/mine/chapter.vue')
  },
  // 推荐票
  {
    path: '/recomTicket',
    name: 'recomTicket',
    component: () => import('../components/mine/recomTicket.vue')
  },
  // 搜索
  {
    path: '/search',
    name: 'search',
    component: () => import('../components/base/search.vue')
  },

]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
